from bdtime import tt
# import pyautogui
# import keyboard
#
#
# target_k = 'w'
# func_down, func_up = keyboard.press, keyboard.release
# # func_down, func_up = pyautogui.keyDown, pyautogui.keyUp
#
# tt.sleep(1)
# func_down(target_k)  # 按住Enter键不释放
# tt.sleep(2)
# func_up(target_k)  # 按住Enter键不释放

import ctypes

# 定义 Windows API 函数和常量
user32 = ctypes.windll.user32
VK_LBUTTON = 0x01

# 检测鼠标左键状态的函数
# def is_left_mouse_button_pressed():
#     return user32.GetKeyState(VK_LBUTTON) < 0

import win32api

# 检测鼠标左键状态的函数
def is_left_mouse_button_pressed():
    return win32api.GetKeyState(VK_LBUTTON) < 0


# 测试函数
def main():
    while True:
        if tt.stop():
            break

        if is_left_mouse_button_pressed():
            print("鼠标左键被按下")
        else:
            print("鼠标左键未被按下")

if __name__ == "__main__":
    main()


